home *** CD-ROM | disk | FTP | other *** search
- /*
- NetWare Alloy Restore Utility
- V4.42 02/07/84 by Mark Hurst
-
- For use with NetWare V4.n systems
-
- Copyright (C) 1983, 1984 Novell, Inc.
- */
-
- #include "ctype.h"
- #include "stdio.h"
-
-
- #define LOCALBIT 0x80
- #define PERMNET 0x01
- #define TEMPNET 0x02
- #define NETBITS 0x03
-
- #define READBIT 0x01
- #define WRITEBIT 0x02
- #define OPENBIT 0x04
- #define CREATEBIT 0x08
- #define DELETEBIT 0x10
- #define OWNEDBIT 0x20
- #define SEARCHBIT 0x40
- #define MODIFYBIT 0x80
-
- /* NOTE: the Archive bit was 0x80 on ShareNet V3.12. Has now changed: */
- #define BACKUPBIT 0x20
-
-
- #define VARPATH '^' - 'A'
-
- #define TRUE 1
- #define FALSE 0
-
- extern FILE *log;
- extern int source, target; /* low level I/O file numbers */
-
-
- char *calloc(), *malloc();
-
-
- typedef struct dosfcb {
- char drive;
- char fname[8];
- char fext[3];
- unsigned curblk;
- unsigned recsize;
- long size;
- unsigned date;
- char reserved[10];
- char relrec;
- char record[4];
- } FCB;
-
- typedef struct exdirfcb {
- char dummy;
- char exset;
- char res[5];
- char flags;
- char drive;
- char fname[8];
- char fext[3];
- char gap[17];
- char size[4];
- } ExDirFCB;
-
- typedef struct exdosfcb {
- char dummy;
- char exset;
- char res[5];
- char flags;
- char drive;
- char fname[8];
- char fext[3];
- unsigned curblk;
- unsigned recsize;
- long size;
- unsigned date;
- char reserved[10];
- char relrec;
- char record[4];
- } ExFCB;
-
-
- extern int listcount;
-
- typedef struct liststruct {
- struct liststruct *link;
- char name[12]; /* 1 too big for even allocation */
- char marked;
- char flags;
- long size; /* size of file in bytes */
- unsigned units; /* size of file in allocation units */
- } LISTNODE;
-
- #define LISTSIZE 250
- extern LISTNODE *list[LISTSIZE], *curnode;
-
- extern ExFCB sourcefile;
- extern ExFCB destfile;
-
-
- int imin();
- unsigned umin();
- long lmin();
-
-
-
- /*--------*/
-
-
- typedef struct setsubstruct {
- int length;
- char function;
- char handle;
- char grant;
- char revoke;
- char speclength;
- } SETSUB;
-
- typedef struct retsubstruct {
- int length;
- } RETSUB;
-
-
- int SetDirRights (drive, rights)
- char drive, rights;
- {
- SETSUB set;
- RETSUB ret;
- char type;
- int ccode;
-
- set.length = 5;
- set.function = 4;
- set.handle = GetHandle (drive, &type);
- set.grant = rights;
- set.revoke = 0xFF; /* clear out old rights first */
- set.speclength = 0;
-
- ret.length = sizeof (RETSUB) - 2;
- ccode = dirpath (&set, &ret);
- return (ccode);
- }
-
- typedef struct gettrust {
- int length;
- char function;
- char handle;
- long trustee;
- char mask;
- char speclength;
- } SETTRUST;
-
- typedef struct rettrust {
- int length;
- } RETTRUST;
-
-
-
- SetTrustee (drive, trustee, rights)
- char drive;
- long trustee;
- char rights;
- {
- SETTRUST set;
- RETTRUST ret;
- char type;
- int ccode, i;
-
- set.length = 8;
- set.function = 13;
- set.handle = GetHandle (drive, &type);
- set.trustee = trustee;
- set.mask = rights;
- set.speclength = 0;
-
- ret.length = sizeof (RETTRUST) - 2;
- ccode = dirpath (&set, &ret);
- }
-
-
- static char *tptr, *tcptr;
-
-
- /* Return 0 if fail to write out trustee rights file, TRUE if OK */
-
-
- rrestore (drive, buffer)
- int drive;
- char *buffer;
- {
- int actual, TCount, i;
- char drights;
- long trustee;
-
- tptr = buffer;
- movmem (tptr, &TCount, 2);
- tptr += 2;
- drights = *tptr ++;
-
- SetDirRights (drive, drights);
-
- for (i = 0; i < TCount; i++ ) {
- movmem (tptr, &trustee, 4);
- tptr += 4;
- drights = *tptr ++;
- SetTrustee (drive, trustee, drights);
- }
- }
-
-